import java.util.Scanner;

public class ArraysNeighbours{
	public static void main(String[] args){
		
		Scanner in = new Scanner(System.in);
		
		System.out.print("Enter quantity of elements in array: ");
		int elements = in.nextInt();
		System.out.print("Enter largest value for element in array: ");
		int limits = in.nextInt();
		
		int testArray[] = new int[elements];
		
		//fill in array with random numbers
		for(int counter = 0; counter < testArray.length; counter++){
			testArray[counter] = 1 + ((int) (Math.random() * limits ));
		}
			//print out array
			for(int counter : testArray)
			System.out.print(counter + " ");
			System.out.println("\n");
		
		//find the smallest value and its index
		int smallest = Math.abs(testArray[0] - testArray[1]);
		int index = 0;
		for(int i = 1; i < testArray.length - 1; i++){
			int value = Math.abs(testArray[i] - testArray[i + 1]);
			if(value < smallest){
				smallest = value;
				index = i;
			}
		}
		//print out the smallest value and its index
		System.out.println(smallest);
		System.out.println(index);
	}
}